package com.neu.app;

import com.neu.util.ScaUtil;
import com.neu.view.UserView;
import com.neu.view.impl.ClientView;

public class AppMain {

    private static UserView userView = new ClientView();
    public static void main(String[] args) {
        while(true){
            System.out.println("欢迎使用账本,请先登录");
            System.out.println("登录:输入1");
            System.out.println("注册:输入2");
            System.out.println("关闭:输入3");
            System.out.println("输入:");
            String sc = ScaUtil.getScanner().next();
            switch (sc){
                case "1":
                    System.out.println("输入真实姓名");
                    String name = ScaUtil.getScanner().next();
                    System.out.println("输入密码");
                    String pwd = ScaUtil.getScanner().next();
                    userView.login(name,pwd);
                    break;
                case "2":
                    System.out.println("输入真实姓名");
                    String name1 = ScaUtil.getScanner().next();
                    System.out.println("输入密码");
                    String pwd1 = ScaUtil.getScanner().next();
                    System.out.println("输入性别:女或男");
                    String sr = ScaUtil.getScanner().next();
                    String sex = sr.equals("男")?"男":"女";
                    System.out.println("输入出生日期");
                    String birthday = ScaUtil.getScanner().next();
                    System.out.println("输入联系电话");
                    String tel = ScaUtil.getScanner().next();
                    userView.register(name1,sex,birthday,pwd1,tel);
                    break;
                case "3":
                    System.exit(0);
                    break;
            }
        }
    }
}
